package com.flurry.android;

import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.text.TextUtils;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import java.util.Collections;
import java.util.List;
import java.util.Map;

final class gg extends WebViewClient
{
  private gg(ft paramft, byte paramByte)
  {
  }

  public final void onLoadResource(WebView paramWebView, String paramString)
  {
    new StringBuilder().append("onLoadResource: url = ").append(paramString).toString();
    super.onLoadResource(paramWebView, paramString);
    if ((paramString == null) || (paramWebView == null) || (paramWebView != ft.b(this.dp)));
    do
    {
      String str;
      do
      {
        do
        {
          return;
          if (!paramString.equalsIgnoreCase(ft.b(this.dp).getUrl()))
            ft.c(this.dp);
        }
        while (ft.d(this.dp));
        str = Uri.parse(paramString).getLastPathSegment();
      }
      while ((str == null) || (!str.equalsIgnoreCase("mraid.js")));
      ft.a(this.dp, true);
      ft.e(this.dp);
    }
    while (!ft.f(this.dp));
    ft.g(this.dp);
    ft.h(this.dp);
  }

  public final void onPageFinished(WebView paramWebView, String paramString)
  {
    new StringBuilder().append("onPageFinished: url = ").append(paramString).toString();
    if ((paramString == null) || (paramWebView == null) || (paramWebView != ft.b(this.dp)));
    do
    {
      return;
      ft.c(this.dp);
      ft.k(this.dp);
      if ((!this.dp.a(ft.b(this.dp))) && ((this.dp.bw() == 2) || (this.dp.bw() == 1)))
        this.dp.addView(ft.b(this.dp));
      ft.b(this.dp, true);
    }
    while (!ft.d(this.dp));
    ft.g(this.dp);
    ft.h(this.dp);
  }

  public final void onPageStarted(WebView paramWebView, String paramString, Bitmap paramBitmap)
  {
    new StringBuilder().append("onPageStarted: url = ").append(paramString).toString();
    if ((paramString == null) || (paramWebView == null) || (paramWebView != ft.b(this.dp)))
      return;
    ft.i(this.dp);
    ft.j(this.dp);
    ft.b(this.dp, false);
    ft.a(this.dp, false);
  }

  public final void onReceivedError(WebView paramWebView, int paramInt, String paramString1, String paramString2)
  {
    this.dp.a("renderFailed", Collections.emptyMap(), this.dp.T, this.dp.S, this.dp.U, 0);
  }

  public final boolean shouldOverrideUrlLoading(WebView paramWebView, String paramString)
  {
    new StringBuilder().append("shouldOverrideUrlLoading: url = ").append(paramString).toString();
    if ((paramString == null) || (paramWebView == null) || (paramWebView != ft.b(this.dp)))
      return false;
    String str1 = UriUtils.currentDir(ft.b(this.dp).getUrl());
    if ((!TextUtils.isEmpty(str1)) && (paramString.startsWith(str1)))
    {
      String str4 = paramString.substring(str1.length());
      Uri localUri2 = Uri.parse(str4);
      if ((localUri2.isHierarchical()) && (!TextUtils.isEmpty(localUri2.getScheme())) && (!TextUtils.isEmpty(localUri2.getAuthority())))
      {
        new StringBuilder().append("shouldOverrideUrlLoading: target url = ").append(str4).toString();
        paramString = str4;
      }
    }
    Uri localUri1 = Uri.parse(paramString);
    if ((localUri1.getScheme() != null) && (localUri1.getScheme().equals("flurry")))
    {
      String str3 = localUri1.getQueryParameter("event");
      Map localMap;
      if (str3 != null)
      {
        ft.l(this.dp).add(str3);
        localMap = fl.H(localUri1.getEncodedQuery());
        if (!localMap.containsKey("guid"))
          break label294;
        AdUnit localAdUnit = ft.a(this.dp, (String)localMap.get("guid"));
        cw localcw = ft.b(this.dp, (String)localMap.get("guid"));
        if ((localAdUnit != null) && (localcw != null))
          this.dp.a(str3, localMap, localAdUnit, localcw, 0, 0);
      }
      while (true)
      {
        return true;
        label294: this.dp.a(str3, localMap, this.dp.T, this.dp.S, this.dp.U, 0);
      }
    }
    this.dp.a("clicked", Collections.emptyMap(), this.dp.T, this.dp.S, this.dp.U, 0);
    if (this.dp.bz())
    {
      ft.b(this.dp).loadUrl(paramString);
      return true;
    }
    String str2 = this.dp.T.getAdSpace().toString();
    Intent localIntent = new Intent(ft.m(this.dp), FlurryFullscreenTakeoverActivity.class);
    localIntent.putExtra("url", paramString);
    if (!this.dp.R.a(ft.m(this.dp), localIntent, str2))
    {
      cy.d(ft.a(this.dp), "Unable to launch FlurryFullscreenTakeoverActivity, falling back to browser. Fix by declaring this Activity in your AndroidManifest.xml");
      this.dp.R.c(ft.m(this.dp), paramString, str2);
    }
    return true;
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.flurry.android.gg
 * JD-Core Version:    0.6.2
 */